<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../include/header.jsp" %>    
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<font  style="margin-left:150px; font-weight: bold;" >${map.count } 명의 회원이 있습니다.</font>
	<input type="hidden" id="count" name="count" value="${map.count }"/>
	<table border="1" style="margin: 5 auto; border: solid black;">
		<tr style="color: white; background-color: black;">
			<th>Rank</th>
			<th>Userid</th>
			<th>Name</th>
			<th colspan="2">등급</th>
			<th>평점합계</th>
			<th colspan="2" width="100">평점평균</th>
			<th>게시물</th>
			<c:if test="${sessionScope.level != null }">
				<th>action</th>			
			</c:if>
			<c:if test="${sessionScope.level == 0 }">
				<th>등급조정</th>			
			</c:if>
		</tr>
		<c:forEach var="row" items="${map.list }">
		<tr>
			<th style="color: white; background-color: black;" >${row.no }</th>
			<th>${row.userid }</th>
			<td>${row.name }</td>
			<td>
				<img alt="${row.level }_level" src="${path }/images/lv/${row.level}.gif"
				style="width: 15px; height: 15px;">
			</td>
			<td>
				<c:choose>
					<c:when test="${row.level == 0}">Admin</c:when>
					<c:when test="${row.level == 1}">마스터쉐프</c:when>
					<c:when test="${row.level == 2}">쉐프</c:when>
					<c:when test="${row.level == 3}">선임요리사</c:when>
					<c:when test="${row.level == 4}">견습요리사</c:when>
					<c:when test="${row.level == 5}">주방보조</c:when>				
				</c:choose>
			</td>			
			<th style="border-left: solid black;">${row.rate_sum }</th>
			<th>${row.rate_avg }</th>
			<th style="color: #cc805b;">
				<c:forEach begin="1" end="${row.rate_avg }" >
					★
				</c:forEach>
			</th>
			<td>${row.count }</td>
			<c:if test="${sessionScope.level != null }">
			<td>				
				<input type="button" value="${row.userid }님의 주방" 
				onclick="location.href='${path}/member/memberDetail.do?userid=${row.userid }';" 
				style="width: 150px; height:25px; color:white; font-weight: bold; background-color:#444411;"/>
			</td>
			</c:if>
			<c:if test="${sessionScope.level == 0 }">
			<td>
				<select id="select_${row.userid }" name="select_${row.userid }">
					<c:choose>
						<c:when test="${row.level == 0 }">
							<option value="0" selected="selected">Admin</option>							
						</c:when>
						<c:when test="${row.level == 1 }">
							<option value="1" selected="selected">마스터쉐프</option>
							<option value="2">쉐프</option>
							<option value="3">선임요리사</option>
							<option value="4">견습요리사</option>
							<option value="5">주방보조</option>
						</c:when>
						<c:when test="${row.level == 2 }">
							<option value="1" >마스터쉐프</option>
							<option value="2" selected="selected">쉐프</option>
							<option value="3">선임요리사</option>
							<option value="4">견습요리사</option>
							<option value="5">주방보조</option>
						</c:when>
						<c:when test="${row.level == 3 }">
							<option value="1" >마스터쉐프</option>
							<option value="2">쉐프</option>
							<option value="3" selected="selected">선임요리사</option>
							<option value="4">견습요리사</option>
							<option value="5">주방보조</option>
						</c:when>
						<c:when test="${row.level == 4 }">
							<option value="1">마스터쉐프</option>
							<option value="2">쉐프</option>
							<option value="3">선임요리사</option>
							<option value="4" selected="selected">견습요리사</option>
							<option value="5">주방보조</option>
						</c:when>
						<c:when test="${row.level == 5 }">
							<option value="1" >마스터쉐프</option>
							<option value="2">쉐프</option>
							<option value="3">선임요리사</option>
							<option value="4">견습요리사</option>
							<option value="5" selected="selected">주방보조</option>
						</c:when>						
					</c:choose>					
				</select>
				<input type="button" value="변경" 
				onclick="update_level('${row.userid}')">
				<input type="button" value="정보수정"	
				onclick="location.href='${path}/admin/member_edit.do?userid=${row.userid}';"/>
			</td>
			</c:if>
		</tr>		
		</c:forEach>		
	</table>	
	
</body>
</html>